import 'package:flutter/material.dart';

class BottomNavigationBarDemo extends StatefulWidget{
  @override
  State<StatefulWidget> createState() {
    // TODO: implement createState
    return _BottomNavigatinBarDemoState();
  }
}

class _BottomNavigatinBarDemoState extends State<BottomNavigationBarDemo>{
  int _currentIndex = 0;
  void _onTapHandler(int index){
     setState(() {
       _currentIndex = index;
     });
  }

  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return BottomNavigationBar(
      currentIndex: _currentIndex,
      onTap: _onTapHandler,
      type: BottomNavigationBarType.fixed,
      fixedColor: Colors.black,
      items: [
        BottomNavigationBarItem(
            icon: Icon(Icons.drafts),
            title: Text('消息'),

        ),
        BottomNavigationBarItem(
            icon: Icon(Icons.location_city),
            title: Text('联系人')
        ),
        BottomNavigationBarItem(
            icon: Icon(Icons.drafts),
            title: Text('动态')
        ),
        BottomNavigationBarItem(
            icon: Icon(Icons.person),
            title: Text('个人')
        )
      ],
    );
  }
}